import { defineConfig } from 'vitepress'
import { mdPlugin } from './plugins'
import { getViteConfig } from './vite'

// https://vitepress.dev/reference/site-config
export default defineConfig({
  title: 'Turborepo项目文档',
  description: 'turborepo集成公共组件、配置文件的项目',
  srcDir: 'views',
  head: [
    ['link', { rel: 'icon', href: '/favicon.svg', sizes: 'any' }],
    ['link', { rel: 'icon', href: '/favicon.svg', type: 'image/svg+xml' }],
    // ['link', { rel: 'stylesheet', href: '//unpkg.com/element-plus/dist/index.css' }],
  ],
  themeConfig: {
    siteTitle: false,
    // https://vitepress.dev/reference/default-theme-config
    nav: [
      { text: '指南', link: '/introduction' },
      { text: 'Examples', link: '/markdown-examples' },
    ],

    sidebar: [
      {
        text: '介绍',
        link: '/introduction',
      },

      {
        text: '组件',
        items: [{ text: 'Button', link: '/components/button' }],
      },

      {
        text: 'Examples',
        items: [
          { text: 'Markdown Examples', link: '/markdown-examples' },
          { text: 'Runtime API Examples', link: '/api-examples' },
          { text: 'Demo', link: '/demo' },
        ],
      },
    ],

    socialLinks: [
      { icon: 'github', link: 'https://github.com/vuejs/vitepress' },
    ],
  },
  vite: getViteConfig(),
  markdown: {
    config: md => mdPlugin(md),
  },
})
